{extend name="public/base" /}

{block name="title"}<title>请假申请</title>{/block}

{block name="pjax_container"}
<style>
    tr>th,
    td {
        text-align: center;
    }

    .btn-group-xs>.btn,
    .btn-xs {
        padding: 5px;
    }



    .content-header>.breadcrumb>li {
        color: #999;
    }

    .content-header>.breadcrumb>.active {
        color: #666;
    }

    .content-header {
        height: 51px;

    }

    .btn-primary {
        background-color: #1890FF;
        color: #fff;
        border: none;
        border-radius: 6px !important;
        padding: 5px 10px;
        line-height: 24px;
    }

    .box-primary {
        border-top-color: #ecf0f5 !important;
        border-top-width: 16px;

    }

    .btn-primary:hover {
        background-color: #1890FF;
        color: #fff;
        border: none;
        opacity: .9;
        border-radius: 6px !important;
    }

    .delete-one {
        background-color: ff4141 !important;
        margin-left: 15px;
        border-radius: 6px;
    }

    .sreachs {
        background-color: #1890FF;
        color: #fff;
        border: none;
        border-radius: 6px !important;
        margin-left: 15px;
        padding: 7px 15px;
    }

    .type_explode {
        color: #fff;
        background-color: #d9534f;
        border-radius: 6px;
        border: none;
    }
</style>
<section class="content-header">
    <ol class="breadcrumb">
        <li>积分管理</li>
        <li class="active">请假申请</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                {include file="form_search/search_leave" /}
                <div class="box-header with-border">
                    <div class="pull-left">
                        {:authAction(CONTROLLER_NAME.'/leave_edit','create')}
                        {:authAction(CONTROLLER_NAME.'/leave_check','create15')}
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>工号</th>
                            <th>姓名</th>
                            <th>请假类型</th>
                            <th>请假天数</th>
                            <th>请假小时</th>
                            <th>申请理由</th>
                            <th>初审人</th>
                            <th>终审人</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        {volist name="$list" id="v"}
                        <tr>
                            <td>{$v["job_number"]}</td>
                            <td>{$v["b_name"]}</td>
                            <td>
                                {if condition="$v.type eq 1"}
                                事假
                                {elseif condition="$v.type eq 2"}
                                病假
                                {elseif condition="$v.type eq 3"}
                                其他
                                {/if}
                            </td>
                            <td>{$v["day"]}</td>
                            <td>{$v["hour"]}</td>
                            <td>{$v["reason"]}</td>
                            <td>{$v["c_name"]}</td>
                            <td>{$v["d_name"]}</td>
                            <td>
                                {if condition="$v.status eq 0"}
                                待初审
                                {elseif condition="$v.status eq 1"}
                                待终审
                                {elseif condition="$v.status eq 2"}
                                审核通过
                                {elseif condition="$v.status eq 3"}
                                    {if condition="$v.check_status eq 2"}
                                        <span style="color:red; font-size:11px; border-radius: 50%;border:1px solid red;width: 17px; height: 16px; display: inline-block;">驳</span>
                                    {/if}
                                拟稿
                                {/if}
                            </td>
                            <td>
                                {if condition="$v.status eq 3"}
                                <form class="form-horizontal" style="display: inline-block" method="POST"
                                    action="{:url('leave_sub')}">
                                    <input name="id" value="{$v.id}" type="hidden">
                                    <input name="check_opinion" class="check_opinion" value="" type="hidden">
                                    <button type="submit" value="{$v.first_check_user_id}" data="{$user_id}"
                                        class="btn btn-sm btn-primary submits audit_sub_submit"><i
                                            class='fa fa-save'></i>
                                        提交</button>
                                </form>
                                {:authAction(CONTROLLER_NAME.'/leave_edit','edit',['id'=>$v['id']])}
                                {/if}
                                {:authAction(CONTROLLER_NAME.'/leave_info','edit2',['id'=>$v['id']])}

                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$list->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function () {
        // 列表部分 全选
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
        $('.checkbox-toggle').on('ifChecked', function (event) {
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("check");
        });
        $('.checkbox-toggle').on('ifUnchecked', function (event) {
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("uncheck");
        });
    });
</script>
<!-- 拟稿提交按钮触发弹窗 -->
<script>
    $(".audit_sub_submit").click(function () {
        var item = $(this);
        var first = $(this).val();
        var now = $(this).attr("data");
        if (first == now) {
            $('#myModal10').modal('hide');
            $('#myModal2').modal('show');
            $("#tips_submit").click(function () {
                var check_opinion = $("#check_opinion_textarea").val();
                item.parents(".form-horizontal").find(".check_opinion").val(check_opinion);
                item.parents(".form-horizontal").submit();
            });
        } else {
            $(this).parents(".form-horizontal").submit();
        }
        return false;

    });
</script>
<!-- 拟稿提交按钮触发弹窗DOM结构 -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2">
    <div class="modal-dialog" role="document">
        <div class="modal-content move">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel2">提示</h4>
            </div>
            <div class="modal_body" style="width: 100%;padding: 20px;">
                <label style="width: 100%;margin: 0;">
                    请填写您的初审意见：
                    <textarea name="check_opinion_textarea" id="check_opinion_textarea" cols="45" rows="5"
                        style="display: block;width: 100%;max-height: 100px; margin:0;padding: 10px;border-radius: 5px;"
                        placeholder="可以输入一千字"></textarea>
                </label>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="tips_submit">确认</button>
            </div>
        </div>
    </div>
</div>

{/block}